 .ONESHELL:

python := python3

package_dir := poker_bot

code_dir := $(package_dir)


define setup_env
    $(eval ENV_FILE := $(1))
    @echo " - setup env $(ENV_FILE)"
    $(eval include $(1))
    $(eval export)
endef

.PHONY: reformat
reformat:
	black $(package_dir)
	isort $(package_dir) --profile black --filter-files

.PHONY: dev-alembic
dev-alembic:
	$(call setup_env, .env.dev)
	alembic -c alembic.ini  upgrade head

.PHONY: dev-bot
dev-bot:
	$(call setup_env, .env.dev)
	python3 -m poker_bot.tg_bot

.PHONY: dev-admin
dev-admin:
	$(call setup_env, .env.dev)
	gunicorn poker_bot.admin_panel.wsgi:app --workers=2 --threads=2 -b 0.0.0.0:5000

.PHONY: dev-arq
def-arq:
	$(call setup_env, .env.dev)
	arq poker_bot.tg_bot.worker.main.WorkerSettings
